#ifndef __FH_PLATSMP_CFG_
#define __FH_PLATSMP_CFG_

#include <mach/fh_predefined.h>
#include "chip.h"
#include "../soc.h"

struct fh_cpu_ctrl {
	int start_addr;
	int reset_reg;
	unsigned int reset_bit;
};

static struct fh_cpu_ctrl cpu_ctrl[CONFIG_NR_CPUS] = {
	[0] = {0},
	[1] = {
		.start_addr = REG_CPU_CORE1_START_ADDR,
		.reset_reg = REG_CPU_SOFT_RST,
		.reset_bit = CPU1_RST_BIT,
	},
	[2] = {
		.start_addr = REG_CPU_CORE2_START_ADDR,
		.reset_reg = REG_CPU_SOFT_RST,
		.reset_bit = CPU2_RST_BIT,
	},
};

#define CPU_START_ADDR(cpu)	(cpu_ctrl[cpu].start_addr)
#define CPU_RST_REG(cpu)	(cpu_ctrl[cpu].reset_reg)
#define CPU_RST_BIT(cpu)	(cpu_ctrl[cpu].reset_bit)

#define CPU_CTRL_REG_BASE	CPU_SYS_APB_REG_BASE

static void fh_cpu_reset(int cpu, int reset)
{
	int rst_bit = CPU_RST_BIT(cpu);

	fh_pmu_set_reg_m(CPU_RST_REG(cpu), (!!reset)<<rst_bit, BIT(rst_bit));
}

static void fh_set_cpu(int cpu, bool enable)
{
	fh_cpu_reset(cpu, !enable);
}

#endif /* __FH_PLATSMP_CFG_ */
